<?php
/**
 * 观察者模式
 *
 */

namespace Trois\Design\Observer;

use Trois\Lib\Help;

abstract class Subject
{
    public array $observers = [];

    public function add(IObserver $object)
    {
        $this->observers[Help::classBasename($object)] = $object;
    }

    public function remove(IObserver $object)
    {
        unset($this->observers[Help::classBasename($object)]);
    }

    abstract function notify();

}